<!doctype html>
<html>
<head>
    <meta charset=utf-8>
    <meta name="robots" content="noindex,nofollow">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="<?=Web_Path?>packs/layui/css/layui.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/font.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/style.css">
    <script src="<?=Web_Path?>packs/js/jquery.min.js"></script>
    <script src="<?=Web_Path?>packs/layui/layui.js"></script>
</head>
<body>
    <span class="layui-breadcrumb" >
        <a ><cite><i class="fa fa-map-marker"></i><?=L('main-0-0')?></cite></a>
        <a href="<?=site_url('opt/main')?>"><?=L('main-0-1')?></a>
        <a href="#"><?=L('cache-0')?></a>
    </span>
    <table class="layui-table">
        <thead>
            <tr>
                <th><?=L('cache-1')?></th>
                <th><?=L('cache-2')?></th>
            </tr>
        </thead>
        <tbody>
            <tr><td><?=L('cache-3')?></td><td><span class="upd_cache" dir="sys"><a href="javascript:;" class="layui-btn layui-btn-mini"><?=L('cache-4')?></a></span></td></tr>
            <tr><td><?=L('cache-5')?></td><td><span  class="upd_cache" dir="home"><a href="javascript:;" class="layui-btn layui-btn-mini"><?=L('cache-4')?></a></span></td></tr>
        <?php
        foreach ($plugins as $row) { 
			$dname = (CS_Language == 'zh_cn') ? $row->name : $row->dir;
            echo '<tr><td>'.$dname.L('cache-6').'</td><td><span  class="upd_cache" dir="'.$row->dir.'"><a href="javascript:;" class="layui-btn layui-btn-mini">'.L('cache-4').'</a></span></td></tr>';
        } 
        ?>
            <tr><td><?=L('cache-7')?></td><td><span  class="upd_cache" dir="img"><a href="javascript:;" class="layui-btn layui-btn-mini"><?=L('cache-4')?></a></span></td></tr>
		<?php if(CS_Cache_On == true){ ?>
            <tr><td><?=L('cache-11')?></td><td><span  class="upd_cache" dir="<?=CS_Cache_Dir?>"><a href="javascript:;" class="layui-btn layui-btn-mini"><?=L('cache-12')?></a></span></td></tr>
		<?php } ?>
    </tbody>
    </table>
    <div class="more_func">
        <a class="layui-btn layui-btn-mini" href="javascript:one_cache();"><i class="fa fa-spinner"></i><?=L('cache-8')?>&nbsp;</a>
        </div>
<script src="<?=Web_Path?>packs/admin/js/cscms.js"></script>
<script>
    cscms.init();
    $(document).ready(function() {
        $('.upd_cache').click(function(event) {
            cache_go($(this));
        });
    });
    function one_cache(){
        var a = $('.upd_cache');
        for (var i = 0; i < a.length; i++) {
            cache_go(a.eq(i));
        }
    }
    function cache_go(obj){
        var dir = obj.attr('dir');
        obj.html("<i class='fa fa-spin fa-spinner'></i><?=L('cache-9')?>");
        $.get('<?=Web_Path.SELF?>/opt/upd_cache/'+dir, function(data) {
            obj.html("<i class='fa fa-check colorl' ></i><?=L('cache-10')?>");
        },"json");
    }
</script>
</body>
</html>
